var myIndent = {
    events: {
        // '#teacherManage #searchBtn click': 'searchBaby',
    },
    init: function () {
        var _this = this;
        Util.event.call(_this, _this.events);
        _this.initTable();
    },
    initTable:function () {
        var _this = this,_url = interfaceURL.getIndentList();
        var c_url = window.location.href.split("?order_no=");
        if(c_url.length != 2){
            return;
        }
        var zTableSetting = {
            async : true,
            requestParam : {
                enable : true,
                url : _url + "?order_no=" + c_url[1]
            },
            usePager:false,
            head:[
                {key:"name",name:"菜品"},{key:"number",name:"数量"},
                {key:"price",name:"小计"},{key:"status_label",name:"订单状态"}
            ],
            callback : {
                asyncSuccess : function (msg) {
                    if(msg.code == "1" && !Util.isEmpty(msg.data)){
                        var _info = msg.data.order_info,_good_list = msg.data.order_goods_info;
                        $.each(_good_list,function (i,v) {
                            if(i == 0){
                                if(_info.status_label == "未到店"){
                                    v.status_label = "<span class='indent-state'>未到店</span>";
                                }else if(_info.status_label == "已到店") {
                                    v.status_label = "<span class='indent-state'>已到店</span>";
                                }else if(_info.status_label == "处理中"){
                                    v.status_label = "<span class='indent-state'>处理中</span>";
                                }
                            }
                            v.name = "<div class='food-item clearfix'><span class='indent-img' style='background: url("+v.goods_cover+") no-repeat center;background-size: 100%;'></span><span class='indent-food-name'>"+v.goods_name+"</span></div>";
                        });
                        $(".my-order-title-text .indent-name").html(_info.shop_name);
                        $(".my-order-title-text .indent-number").html("(订单号："+_info.order_no+")");
                        $('.my-indent-pay .real-pay').html("￥"+_info.total_price);
                        return {
                            zColumns : _good_list
                        }
                    }
                }
            }
        };
        $.fn.zTable.init($(".my-indent-list"), zTableSetting);
    }
}